<template>
  <div id="app" style="height: 100%;">
    <loading :show="isLoading" :delay="delay"></loading>
    <router-view v-show="!isLoading"></router-view>
  </div>
</template>

<script>
  import {Loading} from 'vux'

  export default {
    name: 'app',
    data() {
      return {
        delay: 1e3
      }
    },
    created() {
    },
    components: {
      Loading
    },
    computed: {
      response() {
        return this.$store.state.response;
      },
      isLoading() {
        return this.$store.state.isLoading;
      }
    },
    watch: {
      response(response) {
        if (response.returnCode !== -9 && response.returnCode !== -10) {
          this.$vux.toast.show({
            text: response.returnMsg,
            position: 'middle',
            width: 'auto'
          });
        }else{
          this.$router.replace('/wechatLogin')
        }
      }
    },
    methods: {}
  }
</script>

<style lang="less">
  @import '~vux/src/styles/reset.less';
  @import '~vux/src/styles/1px.less';
  @import '~vux/src/styles/tap.less';

  html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
  }

  body {
    background-color: #fbf9fe;
    font-size: 12px !important;
    padding-top: constant(safe-area-inset-top);
    padding-left: constant(safe-area-inset-left);
    padding-right: constant(safe-area-inset-right);
    padding-bottom: constant(safe-area-inset-bottom);
  }

  div {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
  }

  .text-large {
    font-size: .4rem !important;
  }

  .text-small {
    font-size: .3rem !important;
  }

  .text-red {
    color: #ec1c24;
  }

  .text-green {
    color: #23a376;
  }

  .my-line {
    height: .8rem;
    width: 1px;
    background-color: #ccc;
  }

  button {
    border-radius: 5px;
  }

  .weui-label, .weui-input[disabled] {
    color: #333;
  }

  /*
    .weui-actionsheet {
      z-index: 1001 !important;
    }*/
</style>
